//
//  gxdy_Contact.h
//  OCQ_API_Test
//
//  Created by 故乡的云  on 2017/5/5.
//  Copyright © 2017年 故乡的云 . All rights reserved.
//
//  复制 CNContact 模型，将readonly改为readwrite

#import <Contacts/Contacts.h> // ios9.0 +
#import <AddressBook/AddressBook.h>  // ios9.0 -


@interface gxdy_Contact : NSObject <NSSecureCoding>
@property (copy, NS_NONATOMIC_IOSONLY) NSString * _Nullable identifier;
@property (NS_NONATOMIC_IOSONLY) CNContactType contactType;
@property (copy, NS_NONATOMIC_IOSONLY) NSString * _Nullable namePrefix;
@property (copy, NS_NONATOMIC_IOSONLY) NSString * _Nullable givenName;
@property (copy, NS_NONATOMIC_IOSONLY) NSString * _Nullable middleName;
@property (copy, NS_NONATOMIC_IOSONLY) NSString * _Nullable familyName;
@property (copy, NS_NONATOMIC_IOSONLY) NSString * _Nullable previousFamilyName;
@property (copy, NS_NONATOMIC_IOSONLY) NSString * _Nullable nameSuffix;
@property (copy, NS_NONATOMIC_IOSONLY) NSString * _Nullable nickname;

@property (copy, NS_NONATOMIC_IOSONLY) NSString * _Nullable organizationName;
@property (copy, NS_NONATOMIC_IOSONLY) NSString * _Nullable departmentName;
@property (copy, NS_NONATOMIC_IOSONLY) NSString * _Nullable jobTitle;

@property (copy, NS_NONATOMIC_IOSONLY) NSString * _Nullable phoneticGivenName;
@property (copy, NS_NONATOMIC_IOSONLY) NSString * _Nullable phoneticMiddleName;
@property (copy, NS_NONATOMIC_IOSONLY) NSString * _Nullable phoneticFamilyName;
@property (copy, NS_NONATOMIC_IOSONLY) NSString * _Nullable phoneticOrganizationName;

@property (copy, NS_NONATOMIC_IOSONLY) NSString * _Nullable note;

@property (copy, nullable, NS_NONATOMIC_IOSONLY) NSData *imageData;
@property (copy, nullable, NS_NONATOMIC_IOSONLY) NSData *thumbnailImageData;
@property (NS_NONATOMIC_IOSONLY) BOOL imageDataAvailable;

@property (copy, NS_NONATOMIC_IOSONLY) NSArray<CNLabeledValue<CNPhoneNumber*>*> * _Nullable phoneNumbers;
@property (copy, NS_NONATOMIC_IOSONLY) NSArray<CNLabeledValue<NSString*>*> * _Nullable emailAddresses;
@property (copy, NS_NONATOMIC_IOSONLY) NSArray<CNLabeledValue<CNPostalAddress*>*> * _Nullable postalAddresses;
@property (copy, NS_NONATOMIC_IOSONLY) NSArray<CNLabeledValue<NSString*>*>* _Nullable urlAddresses;
@property (copy, NS_NONATOMIC_IOSONLY) NSArray<CNLabeledValue<CNContactRelation*>*> * _Nullable contactRelations;
@property (copy, NS_NONATOMIC_IOSONLY) NSArray<CNLabeledValue<CNSocialProfile*>*> * _Nullable socialProfiles;
@property (copy, NS_NONATOMIC_IOSONLY) NSArray<CNLabeledValue<CNInstantMessageAddress*>*>* _Nullable instantMessageAddresses;
@property (copy, nullable, NS_NONATOMIC_IOSONLY) NSDateComponents *birthday;
@property (copy, nullable, NS_NONATOMIC_IOSONLY) NSDateComponents *nonGregorianBirthday;
@property (copy, NS_NONATOMIC_IOSONLY) NSArray<CNLabeledValue<NSDateComponents*>*> * _Nullable dates;
/*
 @property (copy, NS_NONATOMIC_IOSONLY) NSString * _Nullable name; // 全名
 @property (nonatomic, copy) NSDateComponents *creationDate; // 第一次添加该记录的时间
 @property (nonatomic, copy) NSDateComponents *modificationDate; // 最后一次修改改天记录的时间
 @property (nonatomic, strong) NSMutableArray  *address; // 地址
 ...
 */
#warning 优化思路：增加其他属性，是数据展示更明了
// 以下获取的模型数据，会因为版本不同，得到的数据会有所差异，ios 9.0- 数据不完整（待完善）
/// ios 9.0
+ (instancetype _Nonnull )contactWithContact:(CNContact *_Nonnull)contact;
/// ios 9.0-
+ (instancetype _Nonnull )contactWithRecordRef:(ABRecordRef _Nonnull)recordRef;
@end

